using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using FrameWork;
using FrameWork.Components;
using FrameWork.WebControls;
using FrameWorkWeb;

namespace FrameWork.web.Module.FrameWork.RoleManager
{
    public partial class RoleList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BusinessFacade.sys_UserCheckManagerVoid();
            if (!Page.IsPostBack)
            {
                
                BindData();
            }
        }


        private void BindData()
        {
            QueryParam qp = new QueryParam();
            
            qp.OrderType = 0;
            qp.PageIndex = AspNetPager1.CurrentPageIndex;
            qp.PageSize = AspNetPager1.PageSize;
            int RecordCount = 0;
            ArrayList lst = BusinessFacade.sys_RolesListUser(qp, out RecordCount);
            GridView1.DataSource = lst;
            GridView1.DataBind();
            this.AspNetPager1.RecordCount = RecordCount;
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData();
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex > -1)
            {
                AllSeach _AllSeach = new AllSeach();
                string strID =((Label)e.Row.FindControl("labwColConfigID")).Text;
                string strWhere="where 1=1 ";
                if(strID=="")
                {
                   strWhere+=" and IsDefault=1 ";
                }
                else
                {
                    strWhere+=" and id="+strID;
                }
                DataTable dt= _AllSeach.SupesoftPage("wColConfig", "ConfigName", int.MaxValue, 1, strWhere, "ConfigName", "0", false).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    ((Label)e.Row.FindControl("labwColConfigName")).Text = dt.Rows[0]["ConfigName"].ToString();
                }
               

            }
        }
    }
}
